
from base import build_request, Json
from scenario.seniverse_weather import now

"""
使用 base.build_request 直接请求 http
"""
url = "https://api.seniverse.com/v3/weather/now.json"
data = {
    "location": "shenzhen",
    "key": "Svt8nM15z02DyvYDt"
}

req = build_request(
    url=url,
    method="get",
    params=data
)

print(req.json_string)

"""
使用 scenario 请求接口
"""
now_dict = now(
    url="https://api.seniverse.com/v3/weather/",
    location="shenzhen",
    key="Svt8nM15z02DyvYDt")

print(Json.convert_dict_to_json_str(now_dict["json_dict"]))
